<template>
  <div class="login-main">
    <div class="login-head">
      <div class="row video-main">
        <div class="col-lg-12 col-md-12">
          <video class="head-video" src="http://cd.ray-live.cn/video/WuKong1.mp4" poster="" autoplay="" loop="" muted=""></video>
        </div>
      </div>
    </div>
    <div class="container">
      <div class="row">
        <div class="col-lg-6 col-md-6 login-form-main">
          <div class="col-lg-3 col-md-3 login-logo">
            <img src="/src/assets/images/login_logo.png" alt="image">
          </div>
          <div class="login-form">
            <h2>登录</h2>
            <form>
              <div class="form-group">

                <input type="text" class="form-control" placeholder="请输入用户名" v-model="uname" >
              </div>
              <div class="form-group">

                <input type="password" class="form-control" placeholder="请输入密码" v-model="pwd"  @keyup.enter="doLogin">
              </div>
              <button type="button" class="default-btn" @click="doLogin">登录</button>
              <div class="or-text"><span></span></div>
              <button type="button" class="google-btn" @click="backPassword">找回密码</button>
            </form>
          </div>
        </div>

      </div>
    </div>
  </div>

</template>

<script setup>
import {ref, reactive, onMounted} from "vue";
import axios from '@/plugins/axios.js'
import router from "@/router/index.js";
import loginUser from '@/stores/LoginUser.js'


let uname = ref("xiaohei")
let pwd = ref("123")

let doLogin = ()=>{
  let url = "login/doUnameTokenLogin"
  let param = {
    "username":uname.value,
    "password":pwd.value
  }
  axios.post(url,param).then(result =>{
    console.log(result.data)
    //登录成功
    if (result !== null && result.code === 200){
      loginUser().userModel = result.data;
      //跳转到首页
      //router.push("/")
    }else {
      console.log(result.code)
    }
  })
}

let backPassword=()=>{
  router.push("/password/error")
}
onMounted(() => {
});
</script>

<style scoped>

</style>